<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<html>
<head>
	<title>退单管理</title>
	<meta name="decorator" content="default"/>
	<script type="text/javascript">
		$(document).ready(function() {
			
		});
		function page(n,s){
			$("#pageNo").val(n);
			$("#pageSize").val(s);
			$("#searchForm").submit();
        	return false;
        }
	</script>
</head>
<body>
	<ul class="nav nav-tabs">
		<li class="active"><a href="${ctx}/ems/emsOrderRefund/">退单列表</a></li>
		<shiro:hasPermission name="ems:emsOrderRefund:edit"><li><a href="${ctx}/ems/emsOrderRefund/form">退单添加</a></li></shiro:hasPermission>
	</ul>
	<form:form id="searchForm" modelAttribute="emsOrderRefund" action="${ctx}/ems/emsOrderRefund/" method="post" class="breadcrumb form-search">
		<input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}"/>
		<input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}"/>
		<ul class="ul-form">
			<li><label>所属订单：</label>
				<form:input path="order.id" htmlEscape="false" maxlength="64" class="input-medium"/>
			</li>
			<li><label>订单名称：</label>
				<form:input path="name" htmlEscape="false" maxlength="32" class="input-medium"/>
			</li>
			<li><label>状态：</label>
				<form:select path="status" class="input-medium">
					<form:option value="" label=""/>
					<form:options items="${fns:getDictList('ems_order_status')}" itemLabel="label" itemValue="value" htmlEscape="false"/>
				</form:select>
			</li>
			<li class="btns"><input id="btnSubmit" class="btn btn-primary" type="submit" value="查询"/></li>
			<li class="clearfix"></li>
		</ul>
	</form:form>
	<sys:message content="${message}"/>
	<table id="contentTable" class="table table-striped table-bordered table-condensed">
		<thead>
			<tr>
				<th>所属订单</th>
				<th>订单名称</th>
				<th>实际金额</th>
				<th>应付金额</th>
				<th>创建时间</th>
				<th>接口返回时间</th>
				<th>状态</th>
				<th>修改时间</th>
				<th>备注</th>
				<shiro:hasPermission name="ems:emsOrderRefund:edit"><th>操作</th></shiro:hasPermission>
			</tr>
		</thead>
		<tbody>
		<c:forEach items="${page.list}" var="emsOrderRefund">
			<tr>
				<td>
					${emsOrderRefund.order.orderNo}
				</td>
				<td>
					${emsOrderRefund.name}
				</td>
				<td>
					${emsOrderRefund.sumMoney}
				</td>
				<td>
					${emsOrderRefund.payMoney}
				</td>
				<td>
					<fmt:formatDate value="${emsOrderRefund.createDate}" pattern="yyyy-MM-dd HH:mm:ss"/>
				</td>
				<td>
					<fmt:formatDate value="${emsOrderRefund.successDate}" pattern="yyyy-MM-dd HH:mm:ss"/>
				</td>
				<td>
					${fns:getDictLabel(emsOrderRefund.status, 'ems_orderrefund_status', '')}
				</td>
				<td>
					<fmt:formatDate value="${emsOrderRefund.updateDate}" pattern="yyyy-MM-dd HH:mm:ss"/>
				</td>
				<td>
					${emsOrderRefund.remarks}
				</td>
				<shiro:hasPermission name="ems:emsOrderRefund:edit"><td>
    				<a href="${ctx}/ems/emsOrderRefund/form?id=${emsOrderRefund.id}">修改</a>
    				<!-- 前台订单、已经支付且有退款申请（状态为待退款，由报名人在前台申请）时，才可以退款 -->
    				<c:if test="${emsOrderRefund.type eq '0' and emsOrderRefund.order.status eq '1' and emsOrderRefund.status eq '0'}">
    					<a href="${ctx}/ems/emsOrderRefund/form?id=${emsOrderRefund.id}" onclick="return confirmx('确认要审批通过并退款吗（待完成！！！）？', this.href)">退款</a>
					</c:if>
					<a href="${ctx}/ems/emsOrderRefund/delete?id=${emsOrderRefund.id}" onclick="return confirmx('确认要删除该退单吗？', this.href)">删除</a>
				</td></shiro:hasPermission>
			</tr>
		</c:forEach>
		</tbody>
	</table>
	<div class="pagination">${page}</div>
</body>
</html>